package com.gavin.export.utils;

import java.util.Random;

/**
 * 随机数工具类
 * @author win10
 *
 */
public class SuijishuUtil {

	public static String getStr() {
		String str = new String();

		Random r = new Random();
		for(int i = 0 ; i < 5 ; i++) {
			int temp = r.nextInt(58) + 65;

			if((temp >= 'A' && temp <= 'Z') || (temp >= 'a' && temp <= 'z')) {
				str += (char)temp;
			}else {
				i--;
			}
		}
		return str;
	}
	
	public static String getStr(Integer num) {
		String str = new String();

		Random r = new Random();
		for(int i = 0 ; i < num ; i++) {
			int temp = r.nextInt(58) + 65;

			if((temp >= 'A' && temp <= 'Z') || (temp >= 'a' && temp <= 'z')) {
				str += (char)temp;
			}else {
				i--;
			}
		}
		return str;
	}
	
}
